package jmine.tec.purge.domain;

import bancosys.tec.persist.builders.AbstractDBBuilder;

/**
 * @author lundberg
 */
public class PurgeConfigBuilder extends AbstractDBBuilder<PurgeConfig> {

    private PurgeConfig entity = this.createBean();

    public static PurgeConfigBuilder aPurgeConfig() {
        PurgeConfigBuilder builder = new PurgeConfigBuilder();
        builder.name("purge").description("Purge").daysToKeep(1);
        builder.cronExpression("1 0 * * *").enabled(true).maxWindowSize(1).purgerBeanName("bean");
        return builder;
    }

    @Override
    protected PurgeConfig doBuild() {
        return this.entity;
    }

    public PurgeConfigBuilder name(String name) {
        this.entity.setName(name);
        return this;
    }

    public PurgeConfigBuilder description(String description) {
        this.entity.setDescription(description);
        return this;
    }

    public PurgeConfigBuilder daysToKeep(Integer daysToKeep) {
        this.entity.setDaysToKeep(daysToKeep);
        return this;
    }

    public PurgeConfigBuilder cronExpression(String cronExpression) {
        this.entity.setCronExpression(cronExpression);
        return this;
    }

    public PurgeConfigBuilder enabled(boolean enabled) {
        this.entity.setEnabled(enabled);
        return this;
    }

    public PurgeConfigBuilder maxWindowSize(Integer maxWindowSize) {
        this.entity.setMaxWindowSize(maxWindowSize);
        return this;
    }

    public PurgeConfigBuilder purgerBeanName(String purgerBeanName) {
        this.entity.setPurgerBeanName(purgerBeanName);
        return this;
    }

}
